package p.ithorns.tools.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.NotBlank;
import java.lang.annotation.*;

/**
 * NotBlankExt
 *
 * 自定义空字段校验，基于{@link NotBlank}, 增加了全角空格的处理
 *
 *
 * @author liuhaitao
 * @version 1.0.0
 * @date 2022/5/5 14:22
 * @see NotBlank
 */
@Documented
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {NotBlankExtValidator.class})
@Repeatable(NotBlankExt.List.class)
public @interface NotBlankExt {

    String message() default "{javax.validation.constraints.NotBlank.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    public @interface List {
        NotBlankExt[] value();
    }
}
